#include <stdio.h>
int num[9][9];
int n;

int main()
{
    num[0][0] = 1;
    int i = 0, j = 0;
    scanf("%d", &n);
    for (int tot = 1; tot < n * n;)
    {
        while (++j < n && num[i][j] == 0)
            num[i][j] = ++tot;
        --j;

        while (++i < n && num[i][j] == 0)
            num[i][j] = ++tot;
        --i;

        while (--j >= 0 && num[i][j] == 0)
            num[i][j] = ++tot;
        ++j;

        while (--i >= 0 && num[i][j] == 0)
            num[i][j] = ++tot;
        ++i;
    }

    for (i = 0; i < n; i++)
        for (j = 0; j < n; j++)
        {
            printf("%3d", num[i][j]);
            if (j == n - 1)
                printf("\n");
        }

    return 0;
}